package com.rtx.edi.model.base;

import java.util.List;

import com.rtx.api.annotation.Exclude;

/**
 * 分页信息实体
 *
 * @param <T>
 * @author Zy
 */
public class PageBean<T> {

    /***
     * 页码 - 当前页
     */
    @Exclude
    private int curPage;

    /***
     * 记录行 - 当前页起始行号
     */
    @Exclude
    private int startPage = 1;

    /**
     * 记录行 - 当前页截止行号
     */
    @Exclude
    private int endPage;

    /***
     * 记录行 - 每页记录数
     */
    @Exclude
    private int pageSize = 20;

    /***
     * 记录行 -总记录数
     */
    @Exclude
    private int total;

    /**
     * 页码 - 总页数
     */
    @Exclude
    private int allPage;

    /**
     * 当前页显示的数据集合
     */
    @Exclude
    private List<T> list;

    /**
     * 当前页
     */
    private Integer current;

    /**
     * 数据行数
     */
    private Integer totalCount;

    /**
     * 页数
     */
    private Integer pageCount;

    /**
     * 数据展示页面路径
     */
    private String pageUrl;

    /**
     * 数据处理对象
     */
    private String queryObj;

    /**
     * 查询条件
     */
    private String queryStr;

    public int getStartPage() {
        if (this.curPage < 1) {
            this.curPage = 1;
        }
        this.startPage = this.pageSize * (this.curPage - 1);
        return startPage;
    }

    public int getEndPage() {
        this.endPage = pageSize * curPage;
        return endPage;
    }

    public int getCurPage() {
        return curPage;
    }

    public void setCurPage(int curPage) {
        this.curPage = curPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getAllPage() {
        this.allPage = (total - 1) / pageSize + 1;
        return allPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public PageBean(int curPage, int pageSize, int total, List<T> list) {
        super();
        this.curPage = curPage;
        this.pageSize = pageSize;
        this.total = total;
        this.list = list;
    }

    public PageBean() {
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public void setEndPage(int endPage) {
        this.endPage = endPage;
    }

    public void setAllPage(int allPage) {
        this.allPage = allPage;
    }

    public Integer getCurrent() {
        return current;
    }

    public void setCurrent(Integer current) {
        this.current = current;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }

    public String getPageUrl() {
        return pageUrl;
    }

    public void setPageUrl(String pageUrl) {
        this.pageUrl = pageUrl;
    }

    public String getQueryObj() {
        return queryObj;
    }

    public void setQueryObj(String queryObj) {
        this.queryObj = queryObj;
    }

    public String getQueryStr() {
        return queryStr;
    }

    public void setQueryStr(String queryStr) {
        this.queryStr = queryStr;
    }
}
